using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public abstract class Goal : MonoBehaviour {
	
	// Properties
	//
	
	public Player PlayerSpecificGoal;
	// If null, consider that the goal is the same for the two players
	
	
	public List<Goal> AssociatedGoals;
	
	// Methods
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public bool CheckGoal(){
		
		bool res = false;
		
		// Check if all the associated goal are true
		if(this.AssociatedGoals.Count > 0 && this.GoalMet()){
			
			res = true;
			
			foreach(Goal g in this.AssociatedGoals){
				// If one goal is not met, return false
				if(!g.GoalMet()){
					res = false;
				}
				
			}
			
		} else {
			
			res = this.GoalMet();
			
		}
		
		
		return res;
		
	}
	
	public abstract bool GoalMet();
	
}
